﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using System.Reflection;

namespace WMS.DAL.Factory
{
    public sealed class DataAccess
    {
        private static readonly string dllPath = ConfigurationManager.AppSettings["SQLiteDAL"];
        private static readonly string cacheKeyPre = "SQLite-";
        public static WMS.IDAL.IUserInfo CreateUserInfo()
        {
            string className = dllPath + ".UserInfoDB";

            return DataAccessCache<WMS.IDAL.IUserInfo>.GetObject(className,cacheKeyPre);
        }

        public static WMS.IDAL.IUnit CreateUnitObject()
        {
            string className = dllPath + ".UnitDB";

            return DataAccessCache<WMS.IDAL.IUnit>.GetObject(className, cacheKeyPre);
        }

        public static WMS.IDAL.IGoods CreateGoodsObject()
        {
            string className = dllPath + ".GoodsDB";

            return DataAccessCache<WMS.IDAL.IGoods>.GetObject(className, cacheKeyPre);
        }

        public static WMS.IDAL.IGoodsLog CreateGoodsLogObject()
        {
            string className = dllPath + ".GoodsLogDB";

            return DataAccessCache<WMS.IDAL.IGoodsLog>.GetObject(className, cacheKeyPre);
        }

        public static WMS.IDAL.ICategory CreateCategoryObject()
        {
            string className = dllPath + ".CategoryDB";

            return DataAccessCache<WMS.IDAL.ICategory>.GetObject(className, cacheKeyPre);
        }

        public static WMS.IDAL.IErrorInfo CreateErrorInfoObject()
        {
            string className = dllPath + ".ErrorInfoDB";

            return DataAccessCache<WMS.IDAL.IErrorInfo>.GetObject(className,cacheKeyPre);
        }
    }
}
